<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>querySelector 学习</title>
</head>
<body>

<p>这是一个 p 与元素。</p>
<p>这也是一个 p 与元素。</p>
<button>测试目标</button>
<p>点击按钮修改文档中第一个 p 元素的背景颜色。</p>
<button onclick="myFunction()">点我</button>
<script>
	// https://www.runoob.com/try/try.php?filename=tryjsref_document_queryselector_p
	function myFunction() {
		document.querySelector("p").style.backgroundColor = "red";
		console.log(document.querySelectorAll("button"));
	    document.querySelector("button").textContent == '123' ? document.querySelector("button").textContent = "1234" : document.querySelector("button").textContent = '123';
	}
</script>

</body>
</html>